package com.jxtc.enterprise.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jxtc.enterprise.common.entity.User;
import com.jxtc.enterprise.hr.dto.EmployeeDepartmentDTO;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;

public interface UserMapper extends BaseMapper<User> {

    List<HashMap<String, Object>> queryUserBasicInfoAndCompanyBasicInfo(@Param("phone") String phone);

    /**
     * 根据公司 ID 分页查询员工及其所在部门信息
     *
     * @param page      分页规则
     * @param companyId 公司 ID
     * @param username  员工名称（如果有则模糊查询）
     * @return 分页后的员工及其部门信息
     */
    Page<EmployeeDepartmentDTO> queryEmployeeWithDepartmentByCompanyIdAndName(
            Page<EmployeeDepartmentDTO> page,
            @Param("companyId") String companyId,
            @Param("username") String username
    );

    int batchUpdateEmployeeLimitCount(@Param("companyId") String companyId, @Param("employeeIds") List<String> employeeIds, @Param("limitCount") int limitCount);

    List<HashMap<String,Object>> queryAllCompanyEmployeeInfos(@Param("companyId") String companyId);

}
